package luogu.dfs;
//P1294 高手去散步

import java.util.Scanner;

/**
 * @author :chenjie
 * @date :Created 2022/12/23 14:08
 */
public class AMasterGoesForAWalk {
    static boolean[]st=new boolean[30];
    static int n;
    static int sum=0;
    static int max;
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        n=sc.nextInt();
        int m=sc.nextInt();
        int[][]arr=new int[n+1][n+1];
        for (int i = 0; i < m; i++) {
            int x=sc.nextInt();
            int y=sc.nextInt();
            int l=sc.nextInt();
            arr[y][x]=l;
            arr[x][y]=l;
        }
        for (int i = 1; i <= n; i++) {
            dfs(i,0,arr);
        }

        System.out.println(max);
    }
    public static void dfs(int x,int u,int[][]arr){
        st[x]=true;
        if(sum>max){
            max=sum;
        }
        if(u==n){
            return;
        }
        for (int i = 1; i <= n; i++) {
            if(arr[x][i]!=0&&!st[i]){
                sum=sum+arr[x][i];
                dfs(i,u+1,arr);
                sum=sum-arr[x][i];
            }
        }
        st[x]=false;
    }
}
